/*
 * =====================================================================================
 *
 *       Filename:  test_fifo.c
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  07/03/15 17:29:01
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Andy (gk), andy_y_li@163.com
 *        Company:  RD
 *
 * =====================================================================================
 */
#include "fifo.h"
#include <stdlib.h>

#define FIFO_SIZE 110

int main()
{
    FIFO bufferFIFO;
    char buf[FIFO_SIZE];
    char *str = "0123456789abcdefghijklmnopqrstuvwxyz";

    fifo_init(&bufferFIFO, FIFO_SIZE, buf);
    fifo_add(&bufferFIFO, str, 300);
    fifo_add(&bufferFIFO, "\nABCDEFG-END", 300);
    char *s = fifo_dump(&bufferFIFO);
    printf("%s\n", (s?s:"null string"));
    if (s) {
        free(s);
    }
    return 0;
}


